<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Vue专栏选择</title>
    <!-- <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script> -->
</head>
<style>
    .category-checkbox {
        display: inline-block;
        margin-right: 10px;
    }
</style>

<body>
    <div id="app">
        <div v-for="item in categories" class="category-checkbox">
            <!-- 绑定数据 -->
            <input type="checkbox" v-model="selectedCategories" :value="item">
            <label>{{ item }}</label>
        </div>
        <ul>
            <li v-for="selected in selectedCategories">{{ selected }}</li>
        </ul>
    </div>
    <script src="../vue.js"></script>
    <script>
        const app = new Vue({
            el: '#app',
            data: {
                // 定义一个数组
                categories: [
                    '科幻', '喜剧', '动漫', '冒险', '科技', '军事', '娱乐', '奇闻'
                ],
                selectedCategories: [] // 初始化一个空数组
            }
        })
    </script>
    </script>
</body>

</html>